<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style>
        html,
        body,
        #mapui {
            width: 100%;
            height: 100%;
        }

        html,
        body {
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="mapui"></div>
    <button type="button" onclick="flyTo()" style="position: absolute;top: 10px;right: 10px;">flyTo</button>
    <button type="button" onclick="fitBounds()" style="position: absolute;top: 10px;right: 100px;">fitBounds</button>
    <button type="button" onclick="easeTo()" style="position: absolute;top: 10px;right: 200px;">easeTo</button>
    <button type="button" onclick="zoomToPoint()" style="position: absolute;top: 10px;right: 300px;">zoomToPoint</button>
    <button type="button" onclick="zoomToLevel()" style="position: absolute;top: 10px;right: 400px;">zoomToLevel</button>
    <button type="button" onclick="zoomToExtent()" style="position: absolute;top: 10px;right: 500px;">zoomToExtent</button>
    
    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>

    <script>
        

        var amap = null;
        map.Factory.create('mapui', {
            style: style,
            center: center,
            zoom: 11,
            strategy: ['mapboxgl', 'openlayers', 'leaflet'],
            fullExtent: {
                xmin: 108.23365,
                ymin: 17.95253,
                xmax: 111.78395,
                ymax: 20.13104
            }
        }, (o) => {
            amap = o;
        });

        function flyTo() {
            amap.flyTo({
                xmin: 108.23365,
                ymin: 17.95253,
                xmax: 111.78395,
                ymax: 20.13104
            });
        }

        function fitBounds() {
            amap.fitBounds({
                xmin: 108.23365,
                ymin: 17.95253,
                xmax: 111.78395,
                ymax: 20.13104
            },{
                padding: {top: 10, bottom:25, left: 15, right: 5}
            });
        }

        function easeTo() {
            amap.easeTo({ center: [110.11323,19.93223] , pitch: 30, bearing: 30, speed: 3000});
        }

        function zoomToPoint() {
            amap.zoomToPoint(110.11323,19.93223);
        }

        function zoomToLevel() {
            amap.zoomToLevel(12);
        }

        function zoomToExtent() {
            amap.zoomToExtent([
                108.23365,
                17.95253,
                111.78395,
                20.13104
            ]);
        }
    </script>
</body>

</html>